# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=thc-smartbrute
pkgver=1.0
pkgrel=3
groups=('blackarch' 'blackarch-cracker' 'blackarch-scanner')
pkgdesc='This tool finds undocumented and secret commands implemented in a smartcard.'
url='https://www.thc.org/thc-smartbrute/'
license=('GPL3')
depends=('pcsclite')
arch=('x86_64' 'aarch64')
DLAGENTS=("https::/usr/bin/curl -k -o %o %u")
source=("https://www.thc.org/thc-smartbrute/thcsmartbrute-$pkgver.tar.gz")
sha512sums=('d75dd86a90d8fa14f83bde81d0c7a5a54cb9ae4ef784b4c7be5c3aa975f062b17ae5e6f3c3495080fb9cfb732d28509de871f37edfc231eef4bfb5683b780252')

build() {
  cd "thcsmartbrute-$pkgver"

  if [[ "$CARCH" == "i686" || "$CARCH" == "x86_64" ]];
  then
    ./configure --prefix=/usr
  else
    ./configure --build=arm --prefix=/usr
  fi

  make
}

package() {
  cd "thcsmartbrute-$pkgver"

  install -Dm 644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" AUTHORS README \
    INSTALL ChangeLog NEWS

  make DESTDIR="$pkgdir" install

  mv "$pkgdir/usr/bin/thcsmartbrute" "$pkgdir/usr/bin/$pkgname"
}

